package vip.xiaozhao.paotui.intf.mapper;

import org.apache.ibatis.annotations.*;
import vip.xiaozhao.paotui.intf.entity.PaotuiWallet;

@Mapper
public interface PaotuiWalletMapper {

    @Select("select * from xzvip_paotui_wallet where id=#{id}")
    PaotuiWallet loadById(int id);

    @Insert("insert into xzvip_paotui_wallet(UserId,Amount,FrozenAmount,Status,AddTime,UpdateTime)" +
            "values (#{userId},#{amount},#{frozenAmount},#{status},now(),now())")
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    int insert(PaotuiWallet wallet);

    @Update("update xzvip_paotui_wallet set UserId = #{userId},Amount = #{amount}," +
            "FrozenAmount = #{frozenAmount},Status = #{status} , UpdateTime = now() where id = #{id} ")
    int update(PaotuiWallet wallet);

    @Select("select * from xzvip_paotui_wallet where UserId = #{userId} ")
    PaotuiWallet loadByUserId(int userId);
}
